(function(){


	/**
	 * 鸟类
	 */
		

	class Bird {
		constructor(){
			this.x = (game.canvas.width - 85) / 3;
			this.w = 85;
			this.h = 60;
			this.y = 100;
			//翅膀的形态 0 1 2
			this.step = 0;

			this.dy = 0;

			//鸟的方向
			this.ro = 0;
			//当前下落的帧编号
			this.dropStatFram = game.frameUtil.currentFrame;
		}

		update(){

			if(game.frameUtil.currentFrame % 6 == 0){
				this.step++;
				this.step %= 2;
			}

			this.dy = 0.01 * Math.pow(game.frameUtil.currentFrame - this.dropStatFram,2);
			this.y+=this.dy;
			this.ro++;
		}

		render(){
			game.ctx.save();
			game.ctx.translate(this.x + this.w / 2, this.y + this.h / 2);
			game.ctx.rotate(Math.PI / 180 * this.ro);
			game.ctx.translate(-(this.x + this.w / 2), -(this.y + this.h / 2));
			game.ctx.drawImage(game.images.bird,this.step * this.w,0,this.w,this.h,this.x,this.y,this.w,this.h);
			game.ctx.restore();
		}
	}


	window.Bird = Bird;



})();
